package com.pgeg.mixin.item;

import com.pgeg.listener.FoodListener;
import com.pgeg.listener.ItemListener;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(Item.class)
public abstract class GlintMixin {

    @Inject(method = "hasGlint", at = @At("RETURN"), cancellable = true)
    private void addGlint(ItemStack stack, CallbackInfoReturnable<Boolean> cir) {
        if (stack.isOf(FoodListener.CARAMEL_APPLE)) {
            cir.setReturnValue(true);
        }
        if (stack.isOf(FoodListener.MANA_CAKE)) {
            cir.setReturnValue(true);
        }
        if (stack.isOf(ItemListener.WAND)) {
            cir.setReturnValue(true);
        }
    }
}
